<?php
/**
 * Created by PhpStorm.
 * User: xiaoxin
 * Date: 2018/10/25 0025
 * Time: 17:01
 */
include './functions.php';
include './Db.php';
$post = $_POST;
session_start();
if (!$_SESSION){
	exit(json_encode(['code'=>1,'msg'=>'请先登陆']));
}
if (!$post['content']){
	exit(json_encode(['code'=>1,'msg'=>'内容不能为空']));
}
$post['create_time']=time();
$post['username']=$_SESSION['username'];
$db = new Db('card');
$res = $db->save($post);
if ($res){
	exit(json_encode(['code'=>0,'msg'=>'发布成功']));
}else{
	exit(json_encode(['code'=>0,'msg'=>'发布失败']));
}
